USE [master]
GO
ALTER DATABASE [$(targetDatabaseName)] SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE [master]
GO
EXEC master.dbo.sp_detach_db @dbname = N'$(targetDatabaseName)'
GO